package com.waste.game.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.waste.game.entity.entitiytv.VideoAllBean;
import com.waste.game.dao.VideoAllDao;
import com.waste.game.entity.entitiytv.VideoPageBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


import java.util.List;

@Slf4j
@RestController
public class VideoSearchController {
    @Autowired
    private VideoAllDao videoAllDao;

    @PostMapping("/api/videosearch/ssapi/{pageNum}/{pageSize}")
    public PageInfo<VideoAllBean> getSearchSX(@RequestBody VideoAllBean videoAllBean,@PathVariable(value = "pageNum") Integer pageNum,@PathVariable(value = "pageSize") Integer pageSize){
        Page<Object> objects = PageHelper.startPage(pageNum,pageSize);
        List<VideoAllBean> list = videoAllDao.getSearchAll(videoAllBean);
        return new PageInfo<>(list);
    }
    @GetMapping("/api/videosearch/{content}/{pageNum}/{pageSize}")
    public PageInfo<VideoAllBean> getSearchVideo(@PathVariable(value = "content") String content,@PathVariable(value = "pageNum") Integer pageNum,@PathVariable(value = "pageSize") Integer pageSize) {
        Page<Object> objects = PageHelper.startPage(pageNum,pageSize);
        List<VideoAllBean> list = videoAllDao.getSearch(content);
        return new PageInfo<>(list);
    }
}
